<!doctype html>
<include file="Public:header"/>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title><{$webData.title}></title>
		<script src="__PUBLIC__/Js/jquery-1.8.3.js"></script>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/Css/index_index.css">
		<script>
		$(function(){
			// 用户名获得焦点时的JS代码
			$("#loginuser").focus(function(){
				$('#name').css('border', '#B24422 1px solid');
				$('#nameimg').attr('src', '__PUBLIC__/Home/Imgs/20140106114505.jpg');
				$(this).css({'outline':'none','color':'black'});
			});
			// 用户名失去焦点时的JS代码
			$("#loginuser").blur(function(){
				$('#name').css('border', '#DEDEDE 1px solid');
				$('#nameimg').attr('src', '__PUBLIC__/Home/Imgs/20140106114606.jpg');
				$(this).css({'outline':'none','color':'#666666'});
			});
			// 密码框获得焦点时的JS代码
			$("input[name=userpwd2]").focus(function(){
			    $(this).hide();
			    $("#login_password_index").show().focus();
				$('#pwd').css('border', '#B24422 1px solid');
				$('#pwdimg').attr('src', '__PUBLIC__/Home/Imgs/20140106114542.jpg');
				$(this).css({'outline':'none', 'color':'#666666'});
			});
			$("#login_password_index").focus(function(){
				$('#pwd').css('border', '#2EA574 1px solid');
				$('#pwdimg').attr('src', '__PUBLIC__/Home/Imgs/20140106114542.jpg');
				$(this).css({'outline':'none', 'color':'black'});
			});
			// 密码框失去焦点时的JS代码
			$("#login_password_index").blur(function(){
				$('#pwd').css('border', '#DEDEDE 1px solid');
				$('#pwdimg').attr('src', '__PUBLIC__/Home/Imgs/20140106114642.jpg');
				$(this).css('color', '#ccc');

				if ($(this).val() == "") { 
		          			$("input[id=loginpwd]").show(); 
		          			$("input[name=userpwd]").hide(); 
         				} 
			});

			/* 图片轮播开始 */
			var pic = 0;

			timer = setInterval(function(){
				var length = $('#right_l input').length;

				pic++;
				pic = pic>length?0:pic;

				var imgurl = $('#right_l input:eq('+pic+')').val();
				var id = $('#right_l input:eq('+pic+')').attr('class');
				var url = '__APP__/Foods/details/id/'+id;
				$('#right_l img').attr({src:imgurl});
				$('#right_l a').attr({href:url});
			},3000);
			/* 图片轮播结束 */

			/*添加到购物车Ajax*/
			$('.addCarts').click(function(){
				
				var fid = $(this).attr('alt');				
				var url = '__APP__/Carts/setCarts/';
				var nowobj = $(this);
				$.post(url,{id:fid},function(cdata){

					if('YES' == cdata.data){
	                                                	
	                                            	nowobj.text('已添加');
	                                        	}else if('NO' == cdata.data){
	                                        		nowobj.text('已存在');                   		
	                                        	}else{                                      		
	                                        		if(!confirm('您还没有登录,去登录吗?')){
                                    				return false;
                                				}
	                                        		window.location.href = "__APP__/Login/login";
	                                        	}

				});
			});

		});
		</script>
	</head>
	<body>
		<div id="index_main">
			<!-- main left start -->
			<div id="main_left">
				<div id="left_l">
					<ul>						
						<volist name="cdata" id="bo">
						<li>				
							<a href="__APP__/Bclass/index/id/<{$bo.id}>" class="foods_type" title="<{$bo.bname}>" alt="<{$bo.id}>">
							<{$bo.bname}>
							</a>
						</li>
						</volist>
					</ul>
				</div>
				<div id="right_l">
					<a href="__APP__/Foods/details/id/<{$favdata[0]['id']}>"><img src="__ROOT__/public/Uploads/<{$favdata[0]['pic']}>" width="518" height="300" /></a>
					<volist name="favdata" id="favvo">
						<input type="hidden" class="<{$favvo.id}>" value="__ROOT__/public/Uploads/<{$favvo.pic}>">
					</volist>
				</div>
				<div class="clear_both"></div>
				<div class="nav_top">
					<span style="color:#909090">新品上架</span>
				</div>
				<div id="xinxiu_img">					
					<volist name="newfoods" id="nvo">
						<div class="newfoods">
							<a href="__APP__/Foods/details/id/<{$nvo.id}>">
								<img src="/eat5/eat/public/Uploads/<{$nvo.pic}>" width="120" height="80">
							</a>
							<font style="font-size:14px;"><{$nvo.name}></font><br />
							<p style="font-size:12px;color:#909090">
								价格：<{$nvo.price}>￥
							</p>
							<font style="margin-left:5px;color:#909090;font-size:12px;">
								<a alt="<{$nvo.id}>" class="addCarts">
									+购物车
								</a>
							</font>	
						</div>
					</volist>					
				</div>
				
				<!-- 循环遍历结果 -->
				<div id="nav_cen">
					<volist name="foodsdata" id="fovo">
						<div style="width:150px;height:auto;overflow:hidden;float:left;margin-right:22px;margin-top:30px;">
							<a href="__APP__/Foods/details/id/<{$fovo.id}>"><img src="__ROOT__/public/Uploads/<{$fovo.pic}>" width="150" height="120"></a><br>
							<font style="font-size:14px;color:#B24422"><{$fovo.name}></font><br>
							<font style="font-size:12px;color:#909090">
								价格：<{$fovo.price}>￥
							</font>
							<font style="margin-left:10px;color:#909090;font-size:12px;">
								<a alt="<{$fovo.id}>" class="addCarts">
									+购物车
								</a>
							</font>
						</div>				
					</volist>
					<div style="clear:both;height:20px;"></div>
				</div>

				<div style="clear:both;height:20px;"></div>
			</div>
			<!-- main left end -->

			<!-- main right start -->
			<div id="main_right">
				<div id="margin_right_top">
					<empty name="Think.session.uname">
						<form action="__APP__/Login/checkLogin/" method="post">
						<table width="250" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td colspan="2">
									<div id="name">
									<img id="nameimg" src="__PUBLIC__/Home/Imgs/20140106114606.jpg" style="float:left;"/><input type="text" id="loginuser" name="username" value="邮箱/用户名" onfocus="if (value =='邮箱/用户名'){value =''}" onblur="if (value ==''){value='邮箱/用户名'}"></div>
								</td>
							</tr>
							<tr height="14">
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<td colspan="2">
									<div id="pwd" style="width:250px;height:40px;line-height:40px;border:#DEDEDE 1px solid;">
									<img id="pwdimg" src="__PUBLIC__/Home/Imgs/20140106114642.jpg" style="float:left;"/>
									<input type="text" id="loginpwd" name="userpwd2" value="密码" style="width:212px;height:40px;float:left;border:none;outline:none;color:#666666">
									<input type="password" name="userpwd" id="login_password_index" style="width:212px;height:40px;float:left;border:none;display:none;outline:none;color:#666666"/>
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<input type="submit" value="登录" style="font-size:16px;color:white;border:none;background:#B24422;width:250px;height:40px;margin-top:10px;">
								</td>
							</tr>
						</table>
					</form>
					<else />
						<table width="90%" style="margin:10px 5%">
							<tr>
								<td></td>
								<td>
<!--									<a href="__APP__/Ucenter/index/header" >-->
									<img src="__ROOT__/Uploads/Users/thumb/th_<{$Think.session.uheadpic}>" width="200" class="uheadpic"/>
									</a>
								</td>
								<td></td>
							</tr>
							<tr>
								<td></td>
								<td align="left" style="text-indent:3em;">
								用户名:<{$Think.session.uname}>
								</td>
								<td></td>
							</tr>
						</table>
					</empty>					
				</div>
				<div style="clear:both;height:30px;background:#F5F4F2;"></div>
				<div style="width:300px;height:250px;float:left;background:url(__PUBLIC__/Home/Imgs/20140122211754.jpg);"></div>

			</div>
			<!-- main right end  -->
		</div>
	</body>
</html>
